/*****************************************************
Copyright (C) 2020. All rights reserved.
File name     ：TestMain.c
Version       ：v1.0
Author        ：zhengqijun
Date          ：2020-05-11
Function List ：
Description   ：main function
******************************************************/

#include <stdio.h>  // for printf
#include "KdTree.h"

// main function
int main(void) {
    KdTree T = NULL;
    ItemType It;
    ItemType L;
    ItemType H;
    int i;

    T = Initialize();

    if (IsEmpty(T)) {
        printf("KdTree is empty!\n");
    } else {
        printf("KdTree is not empty!\n");
    }

    printf("Insert KdTree:\n");
    for (i = 100; i < 300; i+= 5) {
        It[0] = i;
        It[1] = 2000 - i;
        printf("It[0] = %d It[1] = %d\n", It[0], It[1]);
        T = Insert(It, T);
    }
    printf("\n");

    if (IsEmpty(T)) {
        printf("KdTree is empty!\n");
    } else {
        printf("KdTree is not empty!\n");
    }

    L[0] = 120;
    L[1] = 1800;
    H[0] = 200;
    H[1] = 1900;
    printf("Print L(%d, %d) H(%d, %d) in kd-tree:\n", L[0], L[1], H[0], H[1]);
    PrintRange(L, H, T);
    printf("\n");

    T = Destroy(T);

    return 0;
}

// EOF

